<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Multiplication Table on Page</title>
    <style>
        table {
            border-collapse: collapse;
            width: 50%;
            margin: 20px auto;
        }
        th, td {
            border: 1px solid #000;
            padding: 8px;
            text-align: center;
        }
    </style>
</head>
<body>
    <table id="multiplicationTable"></table>

    <script>
        // 生成乘法表并添加到HTML表格中
        function generateMultiplicationTable() {
            const table = document.getElementById('multiplicationTable');

            for (let i = 1; i <= 9; i++) {
                const row = document.createElement('tr');

                for (let j = 1; j <= i; j++) {
                    const cell = document.createElement('td');
                    cell.textContent = `${j} * ${i} = ${j * i}`;
                    row.appendChild(cell);
                }

                table.appendChild(row);
            }
        }

        // 调用函数来生成乘法表
        generateMultiplicationTable();
    </script>
</body>
</html>